﻿using System;
using System.Windows;
using LayeredArchitectureSample.ViewModel;

namespace LayeredArchitectureSample.ClientBrowser
{
    /// <summary>
    /// Interaction logic for LocationsView.xaml
    /// </summary>
    public partial class LocationsView : Window
    {
        private readonly LocationsViewModel _viewModel;

        internal LocationsView(LocationsViewModel viewModel)
        {
            if (viewModel == null) throw new ArgumentNullException("viewModel");

            _viewModel = viewModel;

            this.DataContext = _viewModel;

            InitializeComponent();
        }

        private void RemoveItemButtonClick(object sender, RoutedEventArgs e)
        {
            _viewModel.RemoveSelectedLocation();
        }

        private void AddNewWareButtonClick(object sender, RoutedEventArgs e)
        {
            _viewModel.AddNewLocation();
        }

        private void CloseDownButtonClick(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}